package com.itheima.canal.juc;

import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
// lockaaaaaaaaa
public class RecursionLock {
    public static void main(String[] args) {
          new Thread(new MyRunnable()).start();
    }
}
class MyRunnable implements  Runnable{

    private Lock lock = new ReentrantLock();
    @Override
    public void run() {
          set();
    }
    private void set() {
        lock.lock();
        System.out.println("外层set方法");
        get();
        lock.unlock();
    }

    private  void get() {
        lock.lock();
        System.out.println("外层内层方法");
        lock.unlock();
    }
}
